<?php

// we check if everything is filled in

if(empty($_POST['fname']) || empty($_POST['lname1']) ||empty($_POST['lname2']) || empty($_POST['email']) || empty($_POST['pass']) ||  empty($_POST['fname']) )
{
	die(msg(0,"Debe ingresar todos los campos obligatorios"));
}


// is the sex selected?

if(!(int)$_POST['sex-select'])
{
	die(msg(0,"Debe seleccionar el Sexo"));
}


// is the birthday selected?

if(!(int)$_POST['day'] || !(int)$_POST['month'] || !(int)$_POST['year'])
{
	die(msg(0,"Debe ingresar la fecha de nacimiento"));
}


// is the email valid?

if(!(preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $_POST['email'])))
	die(msg(0,"Debe ingresar un correo valido"));



// Here you must put your code for validating and escaping all the input data,
// inserting new records in your DB and echo-ing a message of the type:



echo msg(1,"registered.html");

// where member-area.php is the address on your site where registered users are
// redirected after registration.

//header( 'Location: http://expediente.saludaunclic.com/interface/login/login_frame.php?site=default' ) ;

function msg($status,$txt)
{
	return '{"status":'.$status.',"txt":"'.$txt.'"}';
}
?>
